
import { IfileListData } from "@/views/documentCenter/config/fileListData"
import { newRecordData } from "./docRecord"


/**
 * @desc: 编辑
 */
export const setRecordEdit = (
  res: IfileListData,
  topParentId: number,
  userInfo: { name: string }
) => {
  let params = {
    operation: 'edit',
    top_parent_id: topParentId,
    user_name: userInfo.name,
    page_id: res.id,
    ...userInfo,
    ...res
  }
  newRecordData(params).then((res) => {
    if (!res) return
  })
}

/**
 * @desc: 查看
 */
export const setRecordView = (
  res: IfileListData,
  topParentId: number,
  userInfo: { name: string }
) => {
  let params = {
    operation: 'view',
    top_parent_id: topParentId,
    user_name: userInfo.name,
    page_id: res.id,
    ...userInfo,
    ...res
  }
  newRecordData(params).then((res) => {
    if (!res) return
  })
}

/**
 * @desc: 新增
 */
export const setRecordAdd = (
  res: IfileListData,
  topParentId: number,
  userInfo: { name: string }
) => {
  let params = {
    operation: 'add',
    top_parent_id: topParentId,
    user_name: userInfo.name,
    page_id: res.id,
    ...userInfo,
    ...res
  }
  newRecordData(params).then((res) => {
    if (!res) return
  })
}
